<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('作业执行阶段维护')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>任务号：</label><input type="text" name="taskNo"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

<!--            <div class="btn-group-sm" id="toolbar" role="group">-->
<!--            </div>-->
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('device:executionphase:edit')}]];
        var removeFlag = [[${@permission.hasPermi('device:executionphase:remove')}]];
        var executionphase = [[${@dict.getType('execution_phase')}]];
        var jobStatusDatas = [[${@dict.getType('job_status')}]];
        var jobTypeDatas = [[${@dict.getType('in_job')}]];
        var prefix = ctx + "device/executionphase";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "设备运行记录",
                clickToSelect: true,//是否启用点击选中行
                columns: [
                    {
                        checkbox: true
                    },
                    {
                        field: 'jobId',
                        title: '作业id'
                    },
                    {
                        field: 'status',
                        title: '作业状态',
                        formatter: function (value, row, index) {
                            if (value == 0) {
                                return "挂起(暂停)";
                            } else if (value == 1) {
                                return "未执行";
                            } else if (value == 2) {
                                return "待执行";
                            } else if (value == 3) {
                                return "正执行";
                            } else if (value == 4) {
                                return "已完成";
                            } else if (value == 5) {
                                return "已作废";
                            } else if (value == 6) {
                                return "需盘点";
                            } else if (value == 7) {
                                return "请求开始视频盘点";
                            } else if (value == 8) {
                                return "出库等待手持机确认";
                            }
                        }
                    },

                    {
                        field: 'taskNo',
                        title: '任务号'
                    },
                    {
                        field: 'trayCode',
                        title: '托盘码'
                    },
                    {
                        field: 'roadwayId',
                        title: '巷道'
                    },
                    {
                        field: 'cargoSpaceId',
                        title: '货位'
                    },
                    {
                        field: 'priority',
                        title: '优先级'
                    },
                    {
                        field: 'executionPhase',
                        title: '执行阶段',
                        halign: 'center',
                        align:'center',
                        sortable: true,
                        formatter: function (value, row, index) {
                            return $.table.selectDictLabel(executionphase, value);

                        }
                    },
                    {
                        field: 'createTime',
                        title: '创建时间'
                    },
                    {
                        field: 'startTime',
                        title: '开始时间'
                    },
                    {
                        field: 'finishTime',
                        title: '完成时间'
                    },
                    {
                        field: 'entranceId',
                        title: '入口'
                    },
                    {
                        field: 'exitId',
                        title: '出口'
                    },
                {
                    title: '操作',
                    halign: 'center',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.jobId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>